package com.wc.alorithm_luogu._模拟.P1009;

import java.math.BigDecimal;
import java.util.Scanner;

/**
 * @Author congge
 * @Date 2023/4/19 17:00
 * @description https://www.luogu.com.cn/problem/P1009
 * 阶乘之和
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        long n = sc.nextInt();

        BigDecimal sum = BigDecimal.valueOf(0);

        BigDecimal curNum = BigDecimal.valueOf(1);

        for (int i = 1; i <= n; i++) {
            curNum = curNum.multiply(BigDecimal.valueOf(i));
//            System.out.println(curNum);
            sum = sum.add(curNum);
        }

        System.out.println(sum);
    }
}
